﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace EMR
{
    public class TemplateBll
    {
        public static Template Load(string name )
        {
            return TemplateDal.Select(name);
        }
        public static  bool AddTemplate(Template template)
        {
            if (TemplateDal.AddTemplate(template) ==1 )
            {
                MessageBox.Show("添加成功！");
                return true;
            }
            else
            {                                                                                              //否则；
                MessageBox.Show("添加失败！");
                return false;
            }
            
        }
        public static bool  EditTemplate(Template template)
        {
            if (TemplateDal.UPdate(template) == 1)
            {
                MessageBox.Show("修改成功！");
                return true;
            }
            else
            {                                                                                              //否则；
                MessageBox.Show("修改失败！");
                return false;
            }
            
        }

        public static bool DeleteTemplate(Template template)
        {
            if(TemplateDal.DeleteTemplate(template.Name)==1)
                 return true;
            else
                return false;
        }
    }
}
